package 观察者模式;

/**
 * @author zzs
 * @ClassName ForecastDisplay.java
 * @Description
 * @createTime 2022年05月10日 16:54:00
 */
public class ForecastDisplay implements Observer, DisplayElement {

    private String message;

    public ForecastDisplay(Subject subject) {
        subject.registerObserver(this);
    }

    @Override
    public void display() {
        System.out.println("收到消息:" + message);
    }

    @Override
    public void update(String message) {
        this.message = message;
        display();
    }
}
